<link href="__PUBLIC__/css/page.css" rel="stylesheet"  type="text/css" />
<div class="pd-20">
	<a class="btn btn-success" onclick="showUserGroup('新增用户组','{:U("Admin/Buyer/addUserGroup")}','4','500',300)">添加用户组</a>
    <if condition="$groups eq null ">
        <div class="row">没有期数</div>
        <else />
        <div class="mt-20">
        	
            <table class="table table-border table-bordered table-bg table-sort table-striped">
                <thead>
                    <tr class="text-c">
                        <th width="50">用户组名</th>
                        <th width="80">创建时间</th>
                        <th width="80">排序</th>
                        <th width="50">操作</th>
                    </tr>
                </thead>
                <!--{$vo.postcode}-->
                <tbody>
                    <volist name="groups" id="group" key="k">
                        <tr class="text-c">
                            <td>{$group.grpname}</td>
                            <td>{$group.create_time|date="Y-m-d H:i:s", ###}</td>
                            <td>{$group.sortid}</td>
                            <td>
	                            <a class="btn btn-success" href="{:U('Admin/Buyer/showGrpUsers', array('gid' => $group['id']))}">查看用户</a>
                            	<a class="btn btn-success" onclick="showUserGroup('修改期数','{:U("Admin/Buyer/addUserGroup", array("gid" =>$group["id"]))}','4','500',350)">修改</a>
                            	<if condition="$group['is_use'] eq 0">
                            	<a class="btn btn-success" href="{:U('Admin/Buyer/useGroup', array('gid' => $group['id']))}">启用</a>
	                            <else/>
	                            <a class="btn btn-success" style="background-color: #ff1cdd;border-color: #ff1cdd;" href="{:U('Admin/Buyer/useGroup', array('gid' => $group['id']))}">启用中</a>
                            	</if>
                            	<a class="btn btn-success" href="{:U('Admin/Buyer/addUser2Grp', array('gid' => $group['id']))}">添加用户</a>
                            	<!-- 如果当前有一期在使用中（准备|进行）的，那就只能开启 -->
                            </td>
                        </tr>
                    </volist>
                </tbody>
            </table>
        </div>
    </if>
    <div class="row cl dataTables_wrapper" id="upage">
        {$page}
    </div>
</div>
<script type="text/javascript" src="__PUBLIC__/lib/layer/layer.js"></script>
<script>
//用户-编辑
function showUserGroup(title, url, id, w, h) {
    layer_show(title, url, w, h);
}
/*
$(document).ready(function(){
	var state = {$state};
	$("option").each(function(){
		var opt_val = $(this).val(); 
		console.log('opt_val = ' + opt_val);
		if(opt_val == state) {
			console.log('opt_val = ' + opt_val + ' 被选中 ');
			$(this).attr("selected",'');
		}
	});
});
*/
</script>
